/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dao;

import java.sql.*;

/**
 *
 * @author 07200765
 */
public class Conexao {
    private boolean connected;
    private Connection innerConnection;

    private void Conexao()  {
        setConnected(false);
    }

    public boolean isConnected() {
        return connected;
    }

    public void setConnected(boolean isConnected) {
        this.connected = isConnected;
    }
    
    public boolean conectar(String url, String user, String pwd) throws SQLException {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            innerConnection = DriverManager.getConnection(url, user, pwd);
            System.out.println("conectou");
            setConnected(true);
            return true;
        }
        catch (ClassNotFoundException e){
            setConnected(false);
            System.out.println("Classe não encontrada");
            return false;
        }
    }

    public Connection getInnerConnection() {
        return innerConnection;
    }


}